<template>
	<div class="box" :class="{ border: border }" :style="{ width: width }">
		<div class="box-header">
			<img class="fontImg" :src="iconUrl" alt="" />
			<span class="sub-title" v-if="props.subTitle">{{ props.subTitle }}</span>
			<img @click="toLocation" src="../../image/icon_location.png" class="title-icon" alt="" />
			<div class="top-right">
				<slot name="rightTop"> </slot>
			</div>
		</div>
		<div class="box-body">
			<slot></slot>
		</div>
	</div>
</template>

<script setup>
const emit = defineEmits(['getLocation']);
const props = defineProps({
	width: {
		type: String,
		default: '388px',
	},
	code: {
		type: String,
		default: '',
	},
	subTitle: {
		type: String,
		default: '',
	},
	showClose: {
		type: Boolean,
		default: false,
	},
	border: {
		type: Boolean,
		default: false,
	},
});

const iconUrl = computed(() => {
	return new URL(`../../image/${props.code}.png`, import.meta.url);
});

const toLocation = () => {
	emit('getLocation');
};
</script>

<style lang="less" scoped>
.box {
	position: relative;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 2px;
	// margin-left: 16px;
	padding-top: 4px;
	margin-right: 16px;
	pointer-events: auto;
	&.border {
		border: 1px solid rgba(0, 119, 149, 1);
	}
	// margin-top: 16px;
	&-header {
		position: relative;
		display: flex;
		align-items: center;
		margin: 0 4px;
		width: calc(100% - 8px);
		height: 48px;
		background: url('../../image/icon_title_bg.png') no-repeat;
		> img {
			height: 16px;
		}
		.fontImg {
			margin-left: 50px;
			margin-top: -5px;
		}
		.title-icon {
			width: 15px;
			height: 15px;
			margin: 0 10px;
			margin-top: -5px;
			cursor: pointer;
		}
		.sub-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 14px;
			color: #e6f6ff;
			margin-left: 50px;
		}
		.top-right {
			position: absolute;
			right: 15px;
			top: 4px;
		}
	}
}
.pagination {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
	font-family: PingFang SC;
	font-weight: 500;
	font-weight: bold;
	color: #c9ffff;
	padding-left: 10px;
	padding-right: 10px;
	margin-top: 10px;
	:deep(.el-pagination) {
		button,
		button:disabled {
			color: #c9ffff !important;
			width: 30px;
			height: 28px;
			background: rgba(59, 179, 229, 0) !important;
			border: 1px solid #c9ffff;
			border-radius: 4px;
			box-sizing: border-box;
		}
		.btn-prev {
			padding-right: 6px;
			margin-right: 6px;
		}
		.btn-next {
			padding-left: 6px;
			margin-left: 6px;
		}
		.el-pager {
			.el-icon {
				color: #c9ffff;
				width: 30px;
				height: 28px;
			}
			.number {
				color: #c9ffff;
				width: 30px;
				height: 28px;
				background: rgba(59, 179, 229, 0);
				border: 1px solid #c9ffff;
				border-radius: 4px;
				line-height: 28px;
				& + .number {
					margin-left: 6px;
				}
				&.active {
					background: rgba(0, 121, 197, 0.6);
					color: #c9ffff;
				}
			}
		}
	}
}
</style>
